//
//  MovementsCell.m
//  WanCaiC8
//
//  Created by tangang on 2018/3/1.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "MovementsCell.h"
@implementation MovementsCell{
    UIImageView *imageV;
    QXLable     *labTitle;
    UIImageView *arrImage;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        WS(weakSelf);
        imageV=[[UIImageView alloc]init];
        [self.contentView addSubview:imageV];
        [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakSelf.contentView);
            make.left.equalTo(weakSelf.contentView).with.offset(13);
            make.size.mas_equalTo(CGSizeMake(42, 42));
        }];
        
        labTitle=[[QXLable alloc]initTitle];
        [self.contentView addSubview:labTitle];
        [labTitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(imageV.mas_right).with.offset(13);
            make.centerY.equalTo(weakSelf.contentView);
            make.size.mas_equalTo(CGSizeMake(200, 30));
        }];
        
        arrImage=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"arrow_right"]];
        [self.contentView addSubview:arrImage];
        [arrImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakSelf.contentView);
            make.right.equalTo(weakSelf.contentView).with.offset(-13);
            make.size.mas_equalTo(arrImage.image.size);
        }];
        
        UIView *line=[[UIView alloc]init];
        line.backgroundColor=DEFAULTBGCOLOR;
        [self.contentView addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.bottom.equalTo(weakSelf.contentView);
            make.height.mas_equalTo(@.7);
        }];
    }
    return self;
}

- (void)setModel:(MovementsModel *)model{
    imageV.image=[UIImage imageNamed:model.image];
    labTitle.text=model.title;
    if (model.isOpen) {
        CGAffineTransform transform =CGAffineTransformMakeRotation(M_PI/2);
        [arrImage setTransform:transform];
    }else{
        CGAffineTransform transform =CGAffineTransformMakeRotation(2*M_PI);
        [arrImage setTransform:transform];
    }
}

- (void)setLotteryModel:(LotteryTypeModel *)model{
    [imageV sd_setImageWithURL:[NSURL URLWithString:model.Logo] placeholderImage:[UIImage imageNamed:@"chat_icon"]];
    labTitle.text=model.Name;
}


@end
